﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BackMoneyCircleReport.aspx.cs" Inherits="ZX.CRM.WEB.Extend.BackMoneyCircleReport" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Highcharts/js/highcharts.js" type="text/javascript"></script>
    <script src="../../Scripts/Highcharts/js/highcharts-more.js" type="text/javascript"></script>


</head>
<body>
    <form id="form1" runat="server">
    <table>
        <tr>
        <td></td>
            <td>
                <div id="BackMoneyGauge" style="height: 90%; width: 200px;">
                </div>
            </td>
            <td>
                <div id="Div1" style="width: 50px;">
                </div>
            </td>
            <td align="left">
                <b>目标:
                    <%=targetValue %>
                    <br />
                    <br />
                     完成:
                    <%=resultValue %>
                </b>
            </td>
        </tr>
    </table>
    
    </form>

    <script type="text/javascript">
        var targetValue = '<%=targetValue %>';
        var resultValue = '<%=resultValue %>';

        $(document).ready(function () {
            //alert(resultValue);
            newGauge("#BackMoneyGauge", "", targetValue, eval("[" + resultValue.toString() + "]"), "万");

            //debugger;
            if (parent.chartNum == 0) {
                parent.chartNum = 1;
                setTimeout(function () {
                   // alert("");
                    this.location.reload();
                }, 10000);
            }
        });


            //创建仪表盘
            var newGauge = function (container, titleText, planAmount, factAmount, unit) {
                $(container).highcharts({
                    chart: {
                        type: 'gauge',
                        plotBackgroundColor: null,
                        plotBackgroundImage: null,
                        plotBorderWidth: 0,
                        plotShadow: false, 
                        spacingTop: -20, 
                        spacingBottom: -20
                    },
                    title: {
                        margin: -50, 
                        text: titleText    //'<span style="font-size:20px">' + titleText + '</span>' 
                    },
                    pane: {
                        startAngle: -150,
                        endAngle: 150
                    },
                    
                    // the value axis
                    yAxis: {
                        min: 0,
                        max: Math.max(planAmount, factAmount),  //planAmount,

                        //lineColor: '#339',

                        minorTickInterval: 'auto',
                        minorTickWidth: 1,
                        minorTickLength: 10,
                        minorTickPosition: 'inside',
                        minorTickColor: '#666',

                        tickPixelInterval: 30,
                        tickWidth: 2,
                        tickPosition: 'inside',
                        tickLength: 10,
                        tickColor: '#666',
                        labels: {
                            step: 2,
                            rotation: 'auto'
                        },
                        title: {
                            //text: '目标: ' + '</br>' + planAmount + ' ' + unit //'万(元)'
                        },
                        plotBands: [{
                            from: Math.max(planAmount, factAmount) * 0.8,   //400,
                            to: Math.max(planAmount, factAmount),   //800,
                            color: '#55BF3B' // green
                        }, {
                            from: Math.max(planAmount, factAmount) * 0.4,  //200,
                            to: Math.max(planAmount, factAmount) * 0.8,  //400,
                            color: '#DDDF0D' // yellow
                        }, {
                            from: 0,
                            to: Math.max(planAmount, factAmount) * 0.4,  //200,
                            color: '#DF5353' // red
                        }]
                    },
                    series: [{
                        name: '完成',
                        dataLabels: {
                            enabled: false
                        },
                        data: factAmount,
                        tooltip: {
                            valueSuffix: '  ' + unit  //''   //' 万'
                        }
                    }]
                });
            }

    </script>
</body>
</html>
